package org.eleorc.ioc.environmentabstraction.profiles;

import org.eleorc.utils.ApplicationContextUtils;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class App {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.getEnvironment().setActiveProfiles(ProfileConstants.DEV);
        context.register(App.class);
        context.scan("org.eleorc.ioc.environmentabstraction.profiles");
        context.refresh();

        ApplicationContextUtils.printBeanDefinitionInfo(context.getBeanFactory());
        context.getEnvironment().getPropertySources().stream().forEach(System.out::println);
        System.out.println("======");
        System.out.println(context.getEnvironment().getProperty("testbean.name"));
    }
}
